public class Test3 {
    public static void main(String[] args) {
        int c = 0;
        for (int i = 1; i < 100; i++) {
            if ( i < 10 ) {
                if ( i % 9 == 0) {
                    c++;
                }
            }
            else if ( i > 10 ) {
                if ( (i % 10) == 9 ) {
                    c++;
                }
                else if ( i /10 == 9) {
                    c++;
                }
                else {
                    continue;
                }
            }
        }
        System.out.println("出现9的次数为:"+c);
    }
}

